<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>后台管理中心-{$title}</title>

  <script src="__Com__/layui/layui.js"></script>
  
  <link rel="stylesheet" href="__Com__/layui/css/layui.css">
  <link rel="stylesheet" href="__Css__/admin.css">

</head>
<body class="layui-layout-body" style="background-color:#eee;">

   <div style="width:350px;max-width:85%;margin:0 auto;margin-top:10%;">

      <div class="layui-form-item">
          <center><h1>后台管理中心</h1></center>
      </div>
      <div class="layui-form-item">
          <input type="text" name="username" required lay-verify="text"  class="layui-input" placeholder="请输入登录账号">
      </div>
      <div class="layui-form-item">
          <input type="password" name="password" required lay-verify="password"  class="layui-input" placeholder="请输入登录密码">
      </div>
      <div class="layui-form-item">
          <input type="text" name="captcha" required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input" style="float:left;width: 45%;">
          <img src="/index.php/captcha.html" alt="captcha" onclick="this.src='/index.php/captcha.html?'+Math.random()"  style="float:right;width:45%;height:38px;" id="captcha"/>
      </div>

      <div class="layui-form-item">
          <button class="layui-btn" style="width:100%;">登  录</button>
      </div>
      <div class="layui-footer" style="color:#c1c1c1;">
           <center> © qq:326840255</center>
      </div>

   </div>


<script>

layui.use(['form'],function(){
  var $=layui.$;
  $("button").click(function(){
      var username=$("input[name='username']").val();
      var password=$("input[name='password']").val();
      var captcha=$("input[name='captcha']").val();
      if(username==''){
          alert("请输入你的账号~");
      }else if(password==''){
          alert("请输入你的密码~");
      }else if(captcha==''){
          alert("请输入你的验证码~");
      }else{
        $(this).attr("disabled",true);
        $.post(location.href,{"username":username,"password":password,"captcha":captcha},function(data){
           if(data=='ok'){
              alert("恭喜你登录成功~","{:Url('index/index')}");
           }else{
             $("button").attr("disabled",false);
             $("#captcha").click();
              alert(data);
           }
        });
      }
  })
});
</script>
<script type="text/javascript" src="__Js__/admin.js"></script>
</body>
</html> 